package com.fanco.learn_datastruct_leetcode.designpattern.iterator;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @author qiaowang 2022/2/22
 * 描述
 */
public class InfoColleage implements Colleage{

    List<Department> departmentList;

    public InfoColleage() {
        departmentList = new ArrayList<>();
        addDepartment("信息工程", "信息工程");
        addDepartment("通信工程", "通信工程");
    }

    @Override
    public String getName() {
        return "信息工程学院";
    }

    @Override
    public void addDepartment(String name, String desc) {
        Department department = new Department(name, desc);
        departmentList.add(department);
    }

    @Override
    public Iterator createIterator() {
        return new InfoColleageIterator(departmentList);
    }
}
